home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS05.ADF / printer / dospecial.c next >
C/C++ Source or Header  |  1986-01-15  |  3KB  |  121 lines

  1.  
  2. /* dospecial.c AmigaLink 1/25/86 */
  3. /* epson X80 special commands */
  4.  
  5. /****** printer.device/printers/Epson_functions **************************
  6.  *
  7.  *   special functions implemented:
  8.  *
  9.  *   aRIN, aSUS0, aSUS1, aSUS2, aSUS3, aSUS4,
  10.  *   aPLU, aPLD, aVERP0, aVERP1, aSLRM, aIND, aCAM
  11.  *
  12.  ************************************************************************/
  13.  
  14. #include    "exec/types.h"
  15. #include    "devices/printer.h"
  16. #include    "devices/prtbase.h"
  17.  
  18. extern struct PrinterData *PD;
  19.  
  20. DoSpecial(command,outputBuffer,vline,currentVMI,crlfFlag,Parms)
  21. char outputBuffer[];
  22. UWORD *command;
  23. BYTE *vline;
  24. BYTE *currentVMI;
  25. BYTE *crlfFlag;
  26. UBYTE Parms[];
  27. {
  28.     int x=0;
  29.     int y=0;
  30.     static char initMarg[]="\033lL\033Qq\033Q\120\033Q\210\033Q\240";
  31.     static char
  32.      initThisPrinter[]="\033x\001\0332\022\0335\033P\033-\376\033F\n\033W";
  33.  
  34.  
  35.     if(*command==aRIN) {
  36.      while(x<18){
  37.          outputBuffer[x]=initThisPrinter[x];
  38.          x++;
  39.      }
  40.      outputBuffer[x++]='\000';
  41.      outputBuffer[12]='\000';
  42.  
  43.      if((PD->pd_Preferences.PrintQuality)==DRAFT)outputBuffer[2]='\000';
  44.  
  45.      *currentVMI=36; /* assume 1/6 line spacing */
  46.      if((PD->pd_Preferences.PrintSpacing)==EIGHT_LPI) { /* wrong again */
  47.          outputBuffer[4]='0';
  48.          *currentVMI=27;
  49.      }
  50.      if ((PD->pd_Preferences.PrintPitch) != PICA)outputBuffer[x++]='\033';
  51.      if((PD->pd_Preferences.PrintPitch)==ELITE)outputBuffer[x++]='M';
  52.      else if((PD->pd_Preferences.PrintPitch)==FINE)
  53.          outputBuffer[x++]='\017';
  54.  
  55.      Parms[0]=(PD->pd_Preferences.PrintLeftMargin);
  56.      Parms[1]=(PD->pd_Preferences.PrintRightMargin);
  57.      *command=aSLRM;
  58.     }
  59.  
  60.     if(*command==aSLRM) {
  61.      initMarg[2]=Parms[0];
  62.      initMarg[5]=Parms[1]+1;
  63.      while(y<6)outputBuffer[x++]=initMarg[y++];
  64.      return(x);
  65.     }
  66.  
  67.     if(*command==aCAM) {
  68.      initMarg[2]=1;
  69.      initMarg[5]=80;
  70.      while(y<15)outputBuffer[x++]=initMarg[y++];
  71.      return(x);
  72.     }
  73.  
  74.     if(*command==aPLU) {
  75.      if((*vline)==0){
  76.          (*vline)=1; 
  77.          *command=aSUS2; 
  78.          return(0);
  79.      }
  80.      if((*vline)<0){
  81.          (*vline)=0; 
  82.          *command=aSUS3; 
  83.          return(0);
  84.      }
  85.      return(-1);
  86.     }
  87.  
  88.     if(*command==aPLD) {
  89.      if((*vline)==0){
  90.          (*vline)=(-1); 
  91.          *command=aSUS4; 
  92.          return(0);
  93.      }
  94.      if((*vline)>0){
  95.          (*vline)=0; 
  96.          *command=aSUS1; 
  97.          return(0);
  98.      }
  99.      return(-1);
  100.     }
  101.  
  102.     if(*command==aSUS0) *vline=0;
  103.     if(*command==aSUS1) *vline=0;
  104.     if(*command==aSUS2) *vline=1;
  105.     if(*command==aSUS3) *vline=0;
  106.     if(*command==aSUS4) *vline=(-1);
  107.  
  108.     if(*command==aVERP0) *currentVMI=27;
  109.  
  110.     if(*command==aVERP1) *currentVMI=36;
  111.  
  112.     if(*command==aIND) {
  113.      outputBuffer[x++]='\033';
  114.      outputBuffer[x++]='J';
  115.      outputBuffer[x++]= *currentVMI;
  116.      return(x);
  117.     }
  118.  
  119.     return(0);
  120. }
  121.